<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      document.addEventListener('click', function (event) {
        // 通过事件对象获取点击的xy坐标
        var x = event.clientX;
        var y = event.clientY;
        console.log(x, y);
      });
    </script>
  </body>
</html>
